package com.care;

import com.alibaba.fastjson.JSON;
import com.yuhang.demo.util.PostUtil;
import org.apache.commons.lang3.StringUtils;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.*;
import java.util.stream.Collector;
import java.util.stream.Collectors;

public class Test {

    static List<int[]> allSorts = new ArrayList<int[]>();

        public static void main(String[] args) throws Exception {


            File file =new File("D:/1.txt");
            BufferedReader br = new BufferedReader(new FileReader(file));

            String ll="";
            StringBuilder sb =new StringBuilder();
            while ((ll=br.readLine())!=null){

                sb.append(ll);
            }


            Map<String,Object> map = JSON.parseObject(sb.toString(),Map.class);


           List<Map<String,Object>> list = (List<Map<String, Object>>) map.get("e3e3_aps");

           List<String> ss =new ArrayList<>();

           List<String> xx=xxx();

           for(int i=0;i<list.size();i++){

               ss.add(list.get(i).get("targetId").toString());

               if(!xx.contains(list.get(i).get("targetId").toString())){

                   System.out.println(list.get(i).get("targetId").toString());
               }
           }

            System.out.println(StringUtils.join(ss,","));




            System.out.println(ss.size());
        }

    public static List<String> xxx() throws Exception {


        File file =new File("D:/2.txt");
        BufferedReader br = new BufferedReader(new FileReader(file));

        String ll="";
        List<String> ss =new ArrayList<>();
        while ((ll=br.readLine())!=null){

            ss.add(ll);
        }



        return ss;
    }





    public static String quoteReplacement(String s) {
        if ((s.indexOf('\\') == -1) && (s.indexOf('$') == -1))
            return s;
        StringBuffer sb = new StringBuffer();
        for (int i=0; i<s.length(); i++) {
            char c = s.charAt(i);
            if (c == '\\') {
                sb.append('\\'); sb.append('\\');
            } else if (c == '$') {
                sb.append('\\'); sb.append('$');
            } else {
                sb.append(c);
            }
        }
        return sb.toString();
    }
    public static void permutation(int[] nums, int start, int end) {
        if (start == end) { // 当只要求对数组中一个数字进行全排列时，只要就按该数组输出即可
            int[] newNums = new int[nums.length]; // 为新的排列创建一个数组容器
            for (int i = 0; i <= end; i++) {
                newNums[i] = nums[i];
            }
            allSorts.add(newNums); // 将新的排列组合存放起来
        } else {
            for (int i = start; i <= end; i++) {
                int temp = nums[start]; // 交换数组第一个元素与后续的元素
                nums[start] = nums[i];
                nums[i] = temp;
                permutation(nums, start + 1, end); // 后续元素递归全排列
                nums[i] = nums[start]; // 将交换后的数组还原
                nums[start] = temp;
            }
        }
    }
}
